package com.dingding.service.core.special.dao.impl;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.dingding.common.core.base.daox.IBaseDaoX;
import com.dingding.common.core.base.daox.ISQLBaseDao;
import com.dingding.common.core.beans.special.Specialuserlogin;
import com.dingding.service.core.special.dao.ISpeicalDriverDao;
import com.dingding.service.core.special.sql.SpecialDriverSQL;

/**
 * 
 * @ClassName: SpeicalDriverDaoImpl 
 * @Description: 专车司机DAO实现类
 * @author YHQ
 * @date 2016年12月5日 下午1:42:32
 * @since V2.5.7
 * 
 */
@Component("speicalDriverDao")
public class SpeicalDriverDaoImpl implements ISpeicalDriverDao{

	private Logger log = Logger.getLogger(this.getClass());
	
	@Resource(name = "SQLBaseDao")
	private ISQLBaseDao sqlBaseDao;
	
	@Resource(name = "baseDaoX")
	private IBaseDaoX baseDaoX;
	
	/**
	 * 
	 * @Title: getSpecialUserLogin 
	 * @Description: 根据手机号获取用户登录信息
	 * @param telPhone 手机号
	 * @author YHQ 
	 * @since V2.5.7
	 * @return Specialuserlogin 用户登录信息
	 * 
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Specialuserlogin getSpecialUserLogin(String telPhone) {
		
		try {
			return sqlBaseDao.sqlToCustomBeanUnique(Specialuserlogin.class, SpecialDriverSQL.GET_SPEICAL_USER_LOGIN_BY_TELPHONE, telPhone);
		} catch (Exception e) {
			log.error("根据手机号获取用户登录信息时出现异常   类：" + this.getClass() + " getSpecialUserLogin()", e);
		}
		
		return null;
	}

	@Override
	public Specialuserlogin getSpecialUserLoginByUserId(String userId) {
		
		try {
			return sqlBaseDao.sqlToCustomBeanUnique(Specialuserlogin.class, SpecialDriverSQL.GET_SPEICAL_USER_LOGIN_BY_USERID, userId);
		} catch (Exception e) {
			log.error("根据手机号获取用户登录信息时出现异常   类：" + this.getClass() + " getSpecialUserLoginByUserId()", e);
		}
		
		return null;
	}

	
}
